Post

Replies

Boosts

Views

Activity

App hangs while opening from background
Hi, My app hangs for about a second when I open the app when it's been in background phase. It doesn't hang every time, but it hangs randomly (like once in 10 times) when I open the app again. I am not able to reproduce what causes this hang. Hang Detection provides hang logs (spindump) when hang occurs. It has something to do with MusicKit as logs mention it but I cannot understand what it is. Please help me understand these logs. I am running iOS 17 beta 1 with MusicKit and ApplicationMusicPlayer. Heaviest stack for the main thread of the target process: 69 start + 2104 (dyld + 87288) [0x1b719b4f8] 69 ??? (Timed + 32864) [0x104ae8060] 69 ??? (SwiftUI + 980040) [0x19840a448] 69 ??? (SwiftUI + 1071088) [0x1984207f0] 69 ??? (SwiftUI + 1667804) [0x1984b22dc] 69 UIApplicationMain + 340 (UIKitCore + 3740336) [0x196c602b0] 69 -[UIApplication _run] + 888 (UIKitCore + 3741260) [0x196c6064c] 69 GSEventRunModal + 164 (GraphicsServices + 4644) [0x1d6199224] 69 CFRunLoopRunSpecific + 600 (CoreFoundation + 527792) [0x1947fedb0] 68 __CFRunLoopRun + 1996 (CoreFoundation + 509348) [0x1947fa5a4] 68 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CoreFoundation + 626340) [0x194816ea4] 68 _dispatch_main_queue_callback_4CF + 44 (libdispatch.dylib + 75296) [0x19c404620] 67 _dispatch_main_queue_drain + 744 (libdispatch.dylib + 76056) [0x19c404918] 67 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72 (libswift_Concurrency.dylib + 274348) [0x19f58cfac] 67 swift::runJobInEstablishedExecutorContext(swift::Job*) + 416 (libswift_Concurrency.dylib + 269688) [0x19f58bd78] 66 ??? (MusicKit + 4857464) [0x208aabe78] 66 ??? (MusicKit + 4856108) [0x208aab92c] 66 -[MusicKit_SoftLinking_MPMusicPlayerController nowPlayingItem] + 24 (MusicKit + 157364) [0x2086306b4] 66 -[MPMusicPlayerController nowPlayingItem] + 24 (MediaPlayer + 1358540) [0x1a681bacc] 66 -[MPMusicPlayerController _nowPlaying] + 372 (MediaPlayer + 1329552) [0x1a6814990] 66 -[MPMusicPlayerController onServer:] + 52 (MediaPlayer + 1333428) [0x1a68158b4] 63 -[MPMusicPlayerApplicationController _establishConnectionIfNeeded] + 1768 (MediaPlayer + 1553848) [0x1a684b5b8] 63 _NSXPCDistantObjectSimpleMessageSend1 + 60 (Foundation + 208348) [0x1937daddc] 63 -[NSXPCConnection _sendSelector:withProxy:arg1:] + 116 (Foundation + 208548) [0x1937daea4] 62 -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2160 (Foundation + 214664) [0x1937dc688] 62 __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__ + 16 (Foundation + 652944) [0x193847690] 62 xpc_connection_send_message_with_reply_sync + 264 (libxpc.dylib + 67488) [0x1fc00d7a0] 62 dispatch_mach_send_with_result_and_wait_for_reply + 60 (libdispatch.dylib + 127760) [0x19c411310] 62 _dispatch_mach_send_and_wait_for_reply + 540 (libdispatch.dylib + 126832) [0x19c410f70] 62 mach_msg + 24 (libsystem_kernel.dylib + 4692) [0x1da082254] 62 mach_msg_overwrite + 436 (libsystem_kernel.dylib + 83544) [0x1da095658] 62 mach_msg2_trap + 8 (libsystem_kernel.dylib + 3332) [0x1da081d04] *62 ??? (<31E57057-A9A0-3BE5-90CB-5C08E9683B34> + 217132) [0xfffffff007e0102c] Thank you. CC @JoeKun
2
0
1.4k
Jun ’23
Parameterized Phrase with Integer
Is it possible to use integer parameter in parameterized phrase? I have an app shortcut where user needs to provide an integer for the app to process it. But the phrase is not recognised by Siri. The one without integer parameter works fine. struct LogWaterShortcuts: AppShortcutsProvider { @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { AppShortcut( intent: LogWaterIntent(), phrases: [ "Log Water in \(.applicationName)", "Log \(\.$quantity) Water in \(.applicationName)" ], shortTitle: "Log Water", systemImageName: "plus" ) } } Is it not possible or I am doing something wrong? If it is not possible then is there any alternative that I can use to achieve the same?
0
0
468
Jun ’23
What does BTAudioSession and BTSmartRoutingDaemon mean?
When I run my watchOS app on a real device, It prints this in the console: watchOS Extension[313:21609] [BTAudioSession] Activate failed: kParamErr (### BTSmartRoutingDaemon not running) watchOS Extension[313:21609] [BTAudioSession] Error: kParamErr (### BTSmartRoutingDaemon not running) What is this BTAudioSession and BTSmartRoutingDaemon? There's nothing available with this name on Apple Developer Documentation neither somewhere on the internet. Note: I am not using any third party frameworks.
1
0
1.4k
Jan ’21
List sections empty after adding .id()
I have a section for each element in array. I need to use ScrollViewReader so I need to add .id() to each row. However, when I add id, list rows become empty. It works fine without id modifier. See the image below: Here's the sample project I have made that demonstrates this problem: import SwiftUI import PlaygroundSupport struct Interval: Identifiable { var id = UUID() var index: Int var name : String { "Interval \(index)" } } struct ContentView: View { var intervals: [Interval] = (1...9).map { index in Interval(index: index) } var body: some View { List { ForEach(intervals, id: \.id) { interval in Section { Text(interval.name) //.id(interval.id) // try removing this comment } } } } } PlaygroundPage.current.setLiveView(ContentView()) Some debugging that I have done: Having only 1 section works, but I need one section for every element. Section { ForEach(intervals, id: \.id) { interval in Text(interval.name) .id(interval.id) } } Adding each section manually also works, but this can't be done as I have lots of section in my actual project. Section { Text(intervals[0].name) .id(intervals[0].id) } Section { Text(intervals[1].name) .id(intervals[1].id) } Does anyone know how to fix this? Thanks.
2
1
1.4k
Feb ’22
Cannot decode library playlists response
Hello, I am fetching library playlists using the endpoint: https://api.music.apple.com/v1/me/library/playlists. After that, I am trying to decode it using a custom struct that has a property named data which is array of Playlist. Here is my code: struct MyPlaylistsResponse: Decodable { let data: [Playlist] } let url = URL(string: "https://api.music.apple.com/v1/me/library/playlists")! let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url)) let dataResponse = try! await dataRequest.response() let decoder = JSONDecoder() do { let playlistsResponse = try decoder.decode(MyPlaylistsResponse.self, from: dataResponse.data) } catch let error { print("**** ERROR ****") print(error) } But the decoding isn’t working. It is giving me the following error: valueNotFound(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "attributes", intValue: nil), CodingKeys(stringValue: "artwork", intValue: nil), CodingKeys(stringValue: "width", intValue: nil)], debugDescription: "Expected Int value but found null instead.", underlyingError: nil)) The response is a playlist and I am trying to decode it using a custom Decodable struct that has an array of Playlist. Decoding Genres work, as shown in session, but playlists aren't working. Am I doing something wrong? Thank you
1
0
1.1k
Jun ’21